/*var lens=  
{  
    _keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",  
    encode:function(e){  
        var t="";  
        var n,r,i,s,o,u,a;  
        var f=0;  
        e=lens._utf8_encode(e);  
        while(f<e.length){  
            n=e.charCodeAt(f++);  
            r=e.charCodeAt(f++);  
            i=e.charCodeAt(f++);  
            s=n>>2;  
            o=(n&3)<<4|r>>4;  
            u=(r&15)<<2|i>>6;  
            a=i&63;  
            if(isNaN(r)){  
                u=a=64  
            }else if(isNaN(i)){  
                a=64  
            }  
            t=t+this._keyStr.charAt(s)+this._keyStr.charAt(o)+this._keyStr.charAt(u)+this._keyStr.charAt(a)  
        }  
        return t  
    },  
    decode:function(e){  
        var t="";  
        var n,r,i;  
        var s,o,u,a;  
        var f=0;  
        e=e.replace(/[^A-Za-z0-9+/=]/g,"");  
        while(f<e.length){  
            s=this._keyStr.indexOf(e.charAt(f++));  
            o=this._keyStr.indexOf(e.charAt(f++));  
            u=this._keyStr.indexOf(e.charAt(f++));  
            a=this._keyStr.indexOf(e.charAt(f++));  
            n=s<<2|o>>4;  
            r=(o&15)<<4|u>>2;  
            i=(u&3)<<6|a;  
            t=t+String.fromCharCode(n);  
            if(u!=64){  
                t=t+String.fromCharCode(r)  
            }  
            if(a!=64){  
                t=t+String.fromCharCode(i)  
            }  
        }  
        t=lens._utf8_decode(t);  
        return t  
    },  
    _utf8_encode:function(e){  
        e=e.replace(/rn/g,"n");  
        var t="";  
        for(var n=0;n<e.length;n++){  
            var r=e.charCodeAt(n);  
            if(r<128){  
                t+=String.fromCharCode(r)  
            }else if(r>127&&r<2048){  
                t+=String.fromCharCode(r>>6|192);  
                t+=String.fromCharCode(r&63|128)  
            }else{  
                t+=String.fromCharCode(r>>12|224);  
                t+=String.fromCharCode(r>>6&63|128);  
                t+=String.fromCharCode(r&63|128)  
            }  
        }  
        return t  
    },  
    _utf8_decode:function(e){  
        var t="";  
        var n=0;  
        var r=c1=c2=0;  
        while(n<e.length){  
            r=e.charCodeAt(n);  
            if(r<128){  
                t+=String.fromCharCode(r);  
                n++  
            }else if(r>191&&r<224){  
                c2=e.charCodeAt(n+1);  
                t+=String.fromCharCode((r&31)<<6|c2&63);  
                n+=2  
            }else{  
                c2=e.charCodeAt(n+1);  
                c3=e.charCodeAt(n+2);  
                t+=String.fromCharCode((r&15)<<12|(c2&63)<<6|c3&63);  
                n+=3  
            }  
        }  
        return t  
    }  
};  */





jQuery.base64 = (function($) {
	var _PADCHAR = "=",
	_ALPHA = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
	_VERSION = "1.0";
	function _getbyte64(s, i) {
		var idx = _ALPHA.indexOf(s.charAt(i));
		if (idx === -1) {
			throw "Cannot decode base64"
		}
		return idx
	}
	function _decode(s) {
		var pads = 0,
		i, b10, imax = s.length,
		x = [];
		s = String(s);
		if (imax === 0) {
			return s
		}
		if (imax % 4 !== 0) {
			throw "Cannot decode base64"
		}
		if (s.charAt(imax - 1) === _PADCHAR) {
			pads = 1;
			if (s.charAt(imax - 2) === _PADCHAR) {
				pads = 2
			}
			imax -= 4
		}
		for (i = 0; i < imax; i += 4) {
			b10 = (_getbyte64(s, i) << 18) | (_getbyte64(s, i + 1) << 12) | (_getbyte64(s, i + 2) << 6) | _getbyte64(s, i + 3);
			x.push(String.fromCharCode(b10 >> 16, (b10 >> 8) & 255, b10 & 255))
		}
		switch (pads) {
		case 1:
			b10 = (_getbyte64(s, i) << 18) | (_getbyte64(s, i + 1) << 12) | (_getbyte64(s, i + 2) << 6);
			x.push(String.fromCharCode(b10 >> 16, (b10 >> 8) & 255));
			break;
		case 2:
			b10 = (_getbyte64(s, i) << 18) | (_getbyte64(s, i + 1) << 12);
			x.push(String.fromCharCode(b10 >> 16));
			break
		}
		return x.join("")
	}
	function _getbyte(s, i) {
		var x = s.charCodeAt(i);
		if (x > 255) {
			throw "INVALID_CHARACTER_ERR: DOM Exception 5"
		}
		return x
	}
	function _encode(s) {
		if (arguments.length !== 1) {
			throw "SyntaxError: exactly one argument required"
		}
		s = String(s);
		var i, b10, x = [],
		imax = s.length - s.length % 3;
		if (s.length === 0) {
			return s
		}
		for (i = 0; i < imax; i += 3) {
			b10 = (_getbyte(s, i) << 16) | (_getbyte(s, i + 1) << 8) | _getbyte(s, i + 2);
			x.push(_ALPHA.charAt(b10 >> 18));
			x.push(_ALPHA.charAt((b10 >> 12) & 63));
			x.push(_ALPHA.charAt((b10 >> 6) & 63));
			x.push(_ALPHA.charAt(b10 & 63))
		}
		switch (s.length - imax) {
		case 1:
			b10 = _getbyte(s, i) << 16;
			x.push(_ALPHA.charAt(b10 >> 18) + _ALPHA.charAt((b10 >> 12) & 63) + _PADCHAR + _PADCHAR);
			break;
		case 2:
			b10 = (_getbyte(s, i) << 16) | (_getbyte(s, i + 1) << 8);
			x.push(_ALPHA.charAt(b10 >> 18) + _ALPHA.charAt((b10 >> 12) & 63) + _ALPHA.charAt((b10 >> 6) & 63) + _PADCHAR);
			break
		}
		return x.join("")
	}
	return {
		decode: _decode,
		encode: _encode,
		VERSION: _VERSION
	}
} (jQuery));